﻿using UnityEngine;
using System.Collections;

public class ActiveChildrenCount : MonoBehaviour 
{
    public int ActiveChildren()
    {
        int amount = 0;

        foreach (Transform child in transform.FindChild("Teeth"))
        {
            if (   child.tag == "Target"
                && child.gameObject.activeSelf
                && child.GetComponent<ToothScript>() != null
                && child.GetComponent<ToothScript>().IsOn)                
            {
                amount++;
            }
        }

        return amount;
    }
}
